package cuiyt.collection.randomitem.mapitreator;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author cyt
 * @create 2020-10-03 下午 10:27
 */
public class test {
    public static void main(String[] args) {

        HashMap<String, Object> map = new HashMap<>();
        map.put("1", "1");
        map.put("2", "2");

        Set<Map.Entry<String, Object>> entries = map.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            System.out.println(entry.getKey() + "- >" + entry.getValue());
        }

        Set<String> strings = map.keySet();
        for (String string : strings) {
            System.out.println(string);
        }

        Collection<Object> values = map.values();
        for (Object value : values) {
            System.out.println(value);
        }
    }
}
